<?php
/*
 *  personal vocabulary training
 */
$typ="qcm";
include("header.inc.php"); //on inclut le haut de page
$return="trainVocVersionAll.php";
####### the feedback after an answer

#get var
$goodwordForeign=$_GET['goodwordForeign'];
$goodwordLocal=$_GET['goodwordLocal'];
$answer=$_GET['answer'];
if(strlen($answer)>0) {
#echo "Reponse: " .$answer; //tests
	if($answer=="0") { //wrong
				$feedback= "Faux!<br>";
		
		$feedback.= "Et non, <span class=\"foreign\">" .$goodwordForeign ."</span> signifie <span class=\"local\">" .$goodwordLocal ."</span>";
	} elseif($answer=="1") { //right
				$feedback= "Juste!<br>";
		
		$feedback.= "Et oui, <span class=\"foreign\">" .$goodwordForeign ."</span> signifie <span class=\"local\">" .$goodwordLocal."</span>";
	} else { //right
		   $feedback="";
	}
	
	echo $feedback ."<br>";
	
	 $sql="INSERT INTO `ergo_training_voc` 
(`userid`, `lang`, `typ`, `foreign`, `local`, `note`) 
VALUES 
('$utilisateur', '$langue', '$typ', '$goodwordForeign' , '$goodwordLocal' , '$answer')
";

#echo $sql; //tests
$sqlI=mysql_query($sql);
if(!$sqlI) {
	echo "erreur MySQL: " .mysql_error();
	exit;
}

echo "<a href=\"" .$return ."\">Return</a>";

 }
include("footer.inc.php"); //on inclut le pied de page
 
 ?>
